#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <opendatawizard.h>
#include <anatomicaltemplate.h>
#include <correlationmatrix.h>
#include <dialog.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkEventQtSlotConnect.h>
#include <views/scatterplotview.h>
#include <views/hierarchicalbundleview.h>
#include <views/taiyunview.h>
#include <vtkCallbackCommand.h>
#include <correlationfilter.h>
#include <distancefilter.h>
#include <deviationfromexpectfilter.h>
#include <views/filterview.h>
#include <QDockWidget>
#include <view3dinteractorstyle.h>
#include <vtkRenderWindowInteractor.h>
#include <views/linkview.h>
#include <views/regionview.h>
#include <QAction>
#include <QLabel>
#include <QRadioButton>
#include <views/infoview.h>
#include <centralwindow.h>

namespace Ui {
    class MainWindow;
    class OpenDataWizard;
}

class MainWindow : public QMainWindow {
    Q_OBJECT

signals:
    void renderAddComplete(vtkRenderer*);
    void colormapChanged();
    void matrixChanged();

private slots:
	void on_actionRedo_last_selection_triggered();
	void on_actionUndo_last_selection_triggered();
    void on_actionView_Edit_data_matrix_triggered();
    void on_actionBlue_to_Yellow_triggered();
    void on_actionLinear_Heat_triggered();
    void on_actionLinear_Blue_to_Yellow_triggered();
    void on_actionLinear_Black_to_White_triggered();
    void on_actionOpen_dataset_triggered();
	void on_actionExit_triggered();
	void on_actionSelect_all_triggered();
	void on_actionDeselect_triggered();
	void on_selectionChanged();
	void on_actionAlways_show_context_triggered();

    void on_OpenDataWizard_accepted();
    void on_renderAddComplete(vtkRenderer*);
	void on_individualChanged(int);

	void on_averageButton_toggled(bool checked);

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void changeEvent(QEvent *e);

private:
    void AddTemplateToRenderer();
	void AddNetworkToRenderer();

    Ui::MainWindow *ui;

    Dialog matrixDialog;

	CentralWindow *centralWindow;
    
	QVector<CorrelationMatrix *> individualMatrices;
	CorrelationMatrix *meanMatrix;
	CorrelationMatrix *medianMatrix;
    
	AnatomicalTemplate *aTemplate;
    FunctionalNetwork *network;
    OpenDataWizard wizard;

    ScatterPlotView *scatterplotWidget;
    HierarchicalBundleView *hierarchicalWidget;
    TaiyunView *taiyunWidget;
	FilterView *filterView;
	LinkView *linkWidget;
	RegionView *regionWidget;
	InfoView *infoView;

	QDockWidget *scatterDock;
	QDockWidget *hierarchDock;
	QDockWidget *taiyunDock;
	QDockWidget *filterDock;
	QDockWidget *infoDock;

	QGroupBox *groupBox;
	QHBoxLayout *horizLayout;
	QVBoxLayout *vertiLayout;

	View3DInteractorStyle *style1;
	View3DInteractorStyle *style2;

	QSlider *individualSlider;
	QLabel *individualInfoLabel;
	QLabel *individualSelectedLabel;

	QRadioButton *averageButton;
	QRadioButton *individualButton;
	QButtonGroup plotGroup;
};

#endif // MAINWINDOW_H
